package com.zc.tools.motionwelder.support;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;

/**
 * <p>
 * <font size="2" face="Times New Roman">MSimpleAnimationPlayer</font><font
 * size="2"></font><font size="2" face="Times New Roman"> plays simple animation
 * without encapsulating sprite in {@link MSprite}, </font>
 * </p>
 * <p>
 * <font color="#000080" size="2" face="Times New Roman"><i>For
 * e.g.;&nbsp;&nbsp;&nbsp; </i></font>
 * </p>
 * <p>
 * <font size="2" color="#000080" face="Times New Roman"><i>&nbsp; MSpriteData
 * butterFlySpriteData = MSpriteLoader.loadSprite( -- - -- -- -);</i></font>
 * </p>
 * <p>
 * <font size="2" color="#000080" face="Times New Roman"><i>&nbsp;
 * MSimpleAnimationPlayer butterFlyPlayer1 = new
 * MSpriteAnimationPlayer(butterFlySpriteData,10,10);<br>
 * &nbsp; MSimpleAnimationPlayer butterFlyPlayer2 = new
 * MSpriteAnimationPlayer(butterFlySpriteData,50,60);</i></font>
 * </p>
 * <p>
 * <font face="Times New Roman">&nbsp; <font size="2" color="#000080"><i>
 * butterFlyPlayer1
 * .setOrientation(MSprite.ORIENTATION_FLIP_H);</i></font></font>
 * </p>
 * <p>
 * <font size="2" color="#000080"
 * face="Times New Roman"><i>&nbsp;&nbsp;&nbsp;butterFlyPlayer1
 * .setLoopOffset(0); // will keep playing and will be looped from 0<br>
 * &nbsp;&nbsp;&nbsp;butterFlyPlayer2.setLoopOffset(0);</i></font>
 * </p>
 * <p>
 * <font size="2" color="#000080" face="Times New Roman"><i>&nbsp;&nbsp;&nbsp;
 * butterFlyPlayer1.update();<br>
 * &nbsp;&nbsp;&nbsp; butterFlyPlayer2.update();</i></font>
 * </p>
 * <p>
 * <font size="2" color="#000080" face="Times New Roman"><i>&nbsp;&nbsp;&nbsp;
 * butterFlyPlayer1.drawFrame(g);<br>
 * &nbsp;&nbsp;&nbsp; butterFlyPlayer2.drawFrame(g);</i></font>
 * </p>
 * <p>
 * &nbsp;
 * </p>
 * 
 * @version 1.0
 * @author Nitin Pokar (pokar.nitin@gmail.com)
 */
public class MSimpleAnimationPlayer extends MPlayer {

	private MSprite sprite;

	private boolean isPlaying;

	/**
	 * 
	 * @param spriteData
	 *            spriteData to be played
	 * @param spriteX
	 *            x position at which animation is to be played
	 * @param spriteY
	 *            y position at which animation is to be played
	 */
	public MSimpleAnimationPlayer(MSpriteData spriteData, MSprite sprite) {
		super(spriteData);
		this.sprite = sprite;
	}

	public int getSpriteDrawX() {
		return sprite.getSpriteDrawX();
	}

	public int getSpriteDrawY() {
		return sprite.getSpriteDrawY();
	}

	public void notifyStartOfAnimation() {
//		isPlaying = true;
	}

	public void notifyEndOfAnimation() {
		sprite.endOfAnimation();
	}

	/**
	 * Method to check if player is currently playing that animation, of
	 * animation has come to an end
	 * 
	 * @return true- if animation is playing , else false
	 */
	public boolean isPlaying() {
		return isPlaying;
	}

	/**
	 * @param orientation
	 *            sprite Orientation, can accept MSprite.ORIENTATION_NONE,
	 *            MSprite.ORIENTATION_FLIP_H, MSprite.ORIENTATION_FLIP_V
	 */
	public void setSpriteOrientation(byte orientation) {
		
	}

	/**
	 * Used by MPlayer to play animation at a given orientation
	 * 
	 * @return sprite orientaion
	 */
	public byte getSpriteOrientation() {
		return sprite.getSpriteOrientation();
	}

	/**
	 * Updates the sprite position by xinc, and yinc
	 */
	public void updateSpritePositionBy(int xinc, int yinc) {
		sprite.updateSpritePosition(xinc, yinc);
	}

}
